package com.example.boardroom.newItems;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.boardroom.R;

import java.util.List;

public class HardwareControlStampAdapter extends BaseQuickAdapter<QueryTimeStamp, BaseViewHolder> {
    public HardwareControlStampAdapter(@Nullable List<QueryTimeStamp> data) {
        super(R.layout.item_hardware_stamp, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, QueryTimeStamp queryTimeStamp) {

        if (!queryTimeStamp.startTime.timeStamp.equals(queryTimeStamp.endTime.timeStamp)) {
            holder.setText(R.id.tv_stamp, queryTimeStamp.startTime.timeStamp + "-" + queryTimeStamp.endTime.timeStamp);
        } else {
            //仍在开灯中
            holder.setText(R.id.tv_stamp, queryTimeStamp.startTime.timeStamp + "-" + "尚未关闭");
        }
        View holderView = holder.getView(R.id.lay_col);
        int itemPosition = getItemPosition(queryTimeStamp);
        if (itemPosition%2==0){
            holderView.setBackgroundColor(getContext().getResources().getColor(R.color.color171C66));
        }else {
            holderView.setBackgroundColor(getContext().getResources().getColor(R.color.color454984));
        }
    }
}
